@ -4,14 +4,13 @@ use child;
use command ::publish ::access ::Access ;
use command ::publish ::access ::Access ;
use failure ::{ self , ResultExt } ;
use failure ::{ self , ResultExt } ;
use slog ::Logger ;
use slog ::Logger ;
use std ::process ::Command ;
/// The default npm registry used when we aren't working with a custom registry.
/// The default npm registry used when we aren't working with a custom registry.
pub const DEFAULT_NPM_REGISTRY : & ' static str = "https://registry.npmjs.org/" ;
pub const DEFAULT_NPM_REGISTRY : & ' static str = "https://registry.npmjs.org/" ;
/// Run the `npm pack` command.
/// Run the `npm pack` command.
pub fn npm_pack ( log : & Logger , path : & str ) -> Result < ( ) , failure ::Error > {
pub fn npm_pack ( log : & Logger , path : & str ) -> Result < ( ) , failure ::Error > {
let mut cmd = Command ::new ( "npm" ) ;
let mut cmd = child ::new_command ( "npm" ) ;
cmd . current_dir ( path ) . arg ( "pack" ) ;
cmd . current_dir ( path ) . arg ( "pack" ) ;
child ::run ( log , cmd , "npm pack" ) . context ( "Packaging up your code failed" ) ? ;
child ::run ( log , cmd , "npm pack" ) . context ( "Packaging up your code failed" ) ? ;
Ok ( ( ) )
Ok ( ( ) )
@ -19,7 +18,7 @@ pub fn npm_pack(log: &Logger, path: &str) -> Result<(), failure::Error> {
/// Run the `npm publish` command.
/// Run the `npm publish` command.
pub fn npm_publish ( log : & Logger , path : & str , access : Option < Access > ) -> Result < ( ) , failure ::Error > {
pub fn npm_publish ( log : & Logger , path : & str , access : Option < Access > ) -> Result < ( ) , failure ::Error > {
let mut cmd = Command ::new ( "npm" ) ;
let mut cmd = child ::new_command ( "npm" ) ;
match access {
match access {
Some ( a ) = > cmd
Some ( a ) = > cmd
. current_dir ( path )
. current_dir ( path )
@ -56,7 +55,7 @@ pub fn npm_login(
// Interactively ask user for npm login info.
// Interactively ask user for npm login info.
// (child::run does not support interactive input)
// (child::run does not support interactive input)
let mut cmd = Command ::new ( "npm" ) ;
let mut cmd = child ::new_command ( "npm" ) ;
cmd . args ( args ) ;
cmd . args ( args ) ;
info ! ( log , "Running {:?}" , cmd ) ;
info ! ( log , "Running {:?}" , cmd ) ;