Skip to content

Commit

Permalink
Call spawn with absolute path if the file exists, or relative path if…
Browse files Browse the repository at this point in the history
… it doesn't (#698)

* Call spawn with absolute path if the file exists, or relative path if it doesn't.

* Use fs.existsSync
  • Loading branch information
ebifrier authored Apr 18, 2020
1 parent b581830 commit 4e18b4e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/enginesyncer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {remote} from 'electron'
import EventEmitter from 'events'
import {existsSync} from 'fs'
import {dirname, resolve} from 'path'
import argvsplit from 'argv-split'
import {v4 as uuid} from 'uuid'
Expand Down Expand Up @@ -87,8 +88,10 @@ export default class EngineSyncer extends EventEmitter {
this.commands = []
this.treePosition = null

this.controller = new Controller(resolve(path), [...argvsplit(args)], {
cwd: dirname(resolve(path))
let absolutePath = resolve(path)
let executePath = existsSync(absolutePath) ? absolutePath : path
this.controller = new Controller(executePath, [...argvsplit(args)], {
cwd: dirname(absolutePath)
})

this.stateTracker = new ControllerStateTracker(this.controller)
Expand Down

0 comments on commit 4e18b4e

Please sign in to comment.