-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Spawn offline process with sls offline
command
#214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! Added some minor feedback.
4e96afd
to
f836b34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wbreza Added some additional functionality for the console logging after looking into sls core. Wanna take another peek?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
*/ | ||
private spawn(command: string, args?: string[], env?: any): Promise<void> { | ||
env = { | ||
...this.serverless.service.provider["environment"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
nice work, looks great 👍 |
Move spawn to offlineService Add styles to logging Fix tests with log statements
bd5ddd8
to
797a444
Compare
} | ||
this.log(`Spawning process '${command} ${args.join(" ")}'`); | ||
return new Promise((resolve, reject) => { | ||
const childProcess = spawn(command, args, {env}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it has been made on purpose (if yes, that requires maybe some documentation), but passing the env
variable here as an option is causing the default value process.env
to not be used (and more particularly the PATH in it). Taking the PATH from process.env
if it hasn't been set as an additional environment variable could be a solution.
sls offline builds Azure Functions files and spawns func host start in the same shell sls offline start spawns func host start in the same shell BaseService has spawn function that spawns and waits for child process in shell (routes stdout and stderr to internal logger) Using mock-spawn library to mock spawned child processes Add invocation commands to config constants
sls offline
builds Azure Functions files and spawnsfunc host start
in the same shellsls offline start
spawnsfunc host start
in the same shellBaseService
hasspawn
function that spawns and waits for child process in shell (routes stdout and stderr to internal logger)mock-spawn
library to mock spawned child processesResolves [AB#569]