Produce -exec without file extensions
On Windows, when we launch the language host, it will end up with a ".exe" file extension at the end of os.Args[0]. This leads us to produce a garbage filename for the -exec script -- namely, pulumi-language-nodejs.exe-exec -- which, of course fails. We simply need to trim off the ".exe" bit before producing the script name.
This commit is contained in:
parent
225bfd46b3
commit
9903adf822
|
@ -67,7 +67,13 @@ func main() {
|
|||
cmdutil.InitTracing(os.Args[0], tracing)
|
||||
var nodeExec string
|
||||
if givenExecutor == "" {
|
||||
bin := os.Args[0] + nodeExecSuffix
|
||||
// The -exec binary is the same name as the current language host, except that we must trim off
|
||||
// the file extension (if any) and then append -exec to it.
|
||||
bin := os.Args[0]
|
||||
if ext := filepath.Ext(bin); ext != "" {
|
||||
bin = bin[:len(bin)-len(ext)]
|
||||
}
|
||||
bin += nodeExecSuffix
|
||||
pathExec, err := exec.LookPath(bin)
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "could not find `%s` on the $PATH", bin)
|
||||
|
|
Loading…
Reference in a new issue