Fix pathing issue when forking process
This commit is contained in:
parent
405266869c
commit
89cc8fe9c6
|
@ -111,6 +111,7 @@ const config = {
|
||||||
fs: 'empty',
|
fs: 'empty',
|
||||||
net: 'empty',
|
net: 'empty',
|
||||||
tls: 'empty',
|
tls: 'empty',
|
||||||
|
child_process: 'empty'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// new WriteFilePlugin(),
|
// new WriteFilePlugin(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const ModuleScraper = require('yt-comment-scraper')
|
const ModuleScraper = require('yt-comment-scraper')
|
||||||
const fs = require('fs')
|
|
||||||
let scraper = null
|
let scraper = null
|
||||||
let currentSort = null
|
let currentSort = null
|
||||||
let currentVideoId = null
|
let currentVideoId = null
|
||||||
|
|
|
@ -7,6 +7,8 @@ import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timesta
|
||||||
import autolinker from 'autolinker'
|
import autolinker from 'autolinker'
|
||||||
import { fork } from 'child_process'
|
import { fork } from 'child_process'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
// eslint-disable-next-line
|
||||||
|
import commentControllerRelativePath from 'file-loader!../../../process/comment-module-controller.js'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'WatchVideoComments',
|
name: 'WatchVideoComments',
|
||||||
|
@ -39,6 +41,10 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isDev: function () {
|
||||||
|
return process.env.NODE_ENV === 'development'
|
||||||
|
},
|
||||||
|
|
||||||
backendPreference: function () {
|
backendPreference: function () {
|
||||||
return this.$store.getters.getBackendPreference
|
return this.$store.getters.getBackendPreference
|
||||||
},
|
},
|
||||||
|
@ -140,9 +146,17 @@ export default Vue.extend({
|
||||||
getCommentDataLocal: function () {
|
getCommentDataLocal: function () {
|
||||||
// we need the path from the working directory to fork correctly
|
// we need the path from the working directory to fork correctly
|
||||||
if (this.commentProcess === null) {
|
if (this.commentProcess === null) {
|
||||||
this.commentProcess = fork('./src/process/comment-module-controller.js', ['args'], {
|
let modulePath
|
||||||
|
if (this.isDev) {
|
||||||
|
modulePath = '../../../process/comment-module-controller.js'
|
||||||
|
} else {
|
||||||
|
modulePath = commentControllerRelativePath
|
||||||
|
}
|
||||||
|
|
||||||
|
this.commentProcess = fork(path.join(__dirname, modulePath), ['args'], {
|
||||||
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
|
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
|
||||||
})
|
})
|
||||||
|
|
||||||
this.commentProcess.on('message', (msg) => {
|
this.commentProcess.on('message', (msg) => {
|
||||||
if (msg.error === null) {
|
if (msg.error === null) {
|
||||||
const commentJSON = JSON.parse(msg.comments)
|
const commentJSON = JSON.parse(msg.comments)
|
||||||
|
@ -212,6 +226,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.commentProcess.send({ id: this.id, sortNewest: this.sortNewest })
|
this.commentProcess.send({ id: this.id, sortNewest: this.sortNewest })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue