mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore: fix binary execution on windows (#1675)
Currenlty the `execNodeTask` helper function resolves the binary from the `package.json` and spawns a new process of it. Specifically on Windows this will break, because the Windows Shell does not know how to run the given files (from the Shebang or PATHEXT) Since those binaries are always node binaries we could manually run the node interpreter and run the given JS file as an argument. Closes #1129
This commit is contained in:
committed by
Jeremy Elbourn
parent
93f8e048ed
commit
e3882fca0e
@@ -115,7 +115,7 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,11 +135,13 @@ export function execNodeTask(packageName: string, executable: string | string[],
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
// Forward to execTask.
|
||||
execTask(binPath, args, options)(done);
|
||||
// Execute the node binary within a new child process using spawn.
|
||||
// The binary needs to be `node` because on Windows the shell cannot determine the correct
|
||||
// interpreter from the shebang.
|
||||
execTask('node', [binPath].concat(args), options)(done);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +187,7 @@ export function vendorTask() {
|
||||
|
||||
|
||||
/** Create a task that serves the dist folder. */
|
||||
export function serverTask(liveReload: boolean = true,
|
||||
export function serverTask(liveReload = true,
|
||||
streamCallback: (stream: NodeJS.ReadWriteStream) => void = null) {
|
||||
return () => {
|
||||
const stream = gulp.src('dist').pipe(gulpServer({
|
||||
@@ -198,7 +200,7 @@ export function serverTask(liveReload: boolean = true,
|
||||
streamCallback(stream);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -209,5 +211,5 @@ export function sequenceTask(...args: any[]) {
|
||||
...args,
|
||||
done
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user