 
     # locate the path and see if it is Agda executable
     validateExecutablePath: (path) -> new Promise (resolve, reject) =>
-        command = path + ' -V'
-        exec command, (error, stdout, stderr) =>
+        path = @parsePath path
+        execFile path, ['-V'], (error, stdout, stderr) =>
             if /^Agda/.test stdout
                 resolve path
             else


    constructor: (@core) ->

    getLibraryPath: ->
        path = atom.config.get('agda-mode.libraryPath')
        path.unshift('.')

{execFile} = require 'child_process'
Promise = require 'bluebird'
Path = require 'path'
{log, warn, error} = require './logger'
Stream = require './executable/stream'
{InvalidExecutablePathError} = require './error'
