@@ -209,7 +209,7 @@ export default class Environment {
209209 envs . push ( Object . assign ( { } , env , {
210210 path : env . path ( ) ,
211211 built : await nix . built ( name ) ,
212- location : await nix . location ( name )
212+ location : nix . location ( name )
213213 } ) )
214214 }
215215 return envs
@@ -225,7 +225,7 @@ export default class Environment {
225225
226226 const desc : any = Object . assign ( { } , this , {
227227 path : this . path ( ) ,
228- location : await nix . location ( this . name ) ,
228+ location : nix . location ( this . name ) ,
229229 packages : await nix . packages ( this . name )
230230 } )
231231
@@ -346,7 +346,7 @@ export default class Environment {
346346
347347 // The Dockerfile does essentially the same as the `docker run` command
348348 // generated above in `dockerRun`...
349- const location = await nix . location ( this . name )
349+ const location = nix . location ( this . name )
350350 const dockerfile = `
351351 FROM alpine
352352 ENV PATH ${ location } /bin:${ location } /sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@@ -380,8 +380,8 @@ export default class Environment {
380380 *
381381 * @param pure Should the shell that this command is executed in be 'pure'?
382382 */
383- async vars ( pure : boolean = false ) : Promise < { [ key : string ] : string } > {
384- const location = await nix . location ( this . name )
383+ async vars ( pure : boolean = false ) : Promise < { [ key : string ] : string } > {
384+ const location = nix . location ( this . name )
385385
386386 let PATH = `${ location } /bin:${ location } /sbin`
387387 if ( ! pure ) PATH += ':' + process . env . PATH
@@ -411,9 +411,16 @@ export default class Environment {
411411 } )
412412 }
413413
414+ /**
415+ * Get an array suitable for passing to `spawn` to execute a docker command with default args for nixster
416+ *
417+ * @param dockerCommand The Docker command to execute
418+ * @param sessionParameters SessionParameters to use for limiting Docker's resource usage
419+ * @param daemonize Should the Docker command be run with the '-d' flag?
420+ */
414421 private async getDockerShellArgs ( dockerCommand : string , sessionParameters : SessionParameters , daemonize : boolean = false ) : Promise < Array < string > > {
415422 const { command, cpuShares, memoryLimit } = sessionParameters
416- const nixLocation = await nix . location ( this . name )
423+ const nixLocation = nix . location ( this . name )
417424 const shellArgs = [
418425 dockerCommand , '--interactive' , '--tty' , '--rm' ,
419426 // Prepend the environment path to the PATH variable
@@ -552,7 +559,12 @@ export default class Environment {
552559 if ( platform === Platform . UNIX && command ) shellProcess . write ( command + '\r' )
553560 }
554561
555- private async checkContainerRunning ( containerId : string ) {
562+ /**
563+ * Determine if a Docker container is running using 'docker ps'
564+ *
565+ * @param containerId The ID of the container, can either be the long or truncated version.
566+ */
567+ private async checkContainerRunning ( containerId : string ) : Promise < boolean > {
556568 const containerRegex = new RegExp ( / ^ [ ^ _ \W ] { 12 } $ / )
557569 if ( containerRegex . exec ( containerId ) === null ) {
558570 throw new Error ( `'${ containerId } ' is not a valid docker container ID.` )
@@ -591,7 +603,7 @@ export default class Environment {
591603
592604 // The Dockerfile does essentially the same as the `docker run` command
593605 // generated above in `dockerRun`...
594- const location = await nix . location ( this . name )
606+ const location = nix . location ( this . name )
595607 const dockerfile = `
596608FROM alpine
597609ENV PATH ${ location } /bin:${ location } /sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
0 commit comments