@@ -849,13 +849,7 @@ function run() {
849849 }
850850 if ( command === 'smoke' ) {
851851 const binaryPath = path . resolve ( argument ( 'binary' ) ) ;
852- const result = childProcess . spawnSync ( binaryPath , [ ] , { stdio : 'inherit' } ) ;
853- if ( result . error ) throw result . error ;
854- if ( result . signal || result . status !== 0 ) {
855- throw new Error (
856- `RUST_BINARY_SMOKE_FAILED: status=${ result . status } signal=${ result . signal || 'none' } `
857- ) ;
858- }
852+ smokeExecutable ( binaryPath , 'RUST_BINARY_SMOKE_FAILED' ) ;
859853 process . stdout . write ( `Rust release executable exited 0: ${ binaryPath } \n` ) ;
860854 return ;
861855 }
@@ -871,13 +865,7 @@ function run() {
871865 declaration . executable
872866 ) ;
873867 fs . writeFileSync ( binaryPath , executable , { mode : 0o755 } ) ;
874- const result = childProcess . spawnSync ( binaryPath , [ ] , { stdio : 'inherit' } ) ;
875- if ( result . error ) throw result . error ;
876- if ( result . signal || result . status !== 0 ) {
877- throw new Error (
878- `RUST_ARCHIVE_SMOKE_FAILED: status=${ result . status } signal=${ result . signal || 'none' } `
879- ) ;
880- }
868+ smokeExecutable ( binaryPath , 'RUST_ARCHIVE_SMOKE_FAILED' ) ;
881869 } finally {
882870 fs . rmSync ( directory , { recursive : true , force : true } ) ;
883871 }
@@ -903,6 +891,26 @@ function run() {
903891 ) ;
904892}
905893
894+ const SMOKE_GREETING = Buffer . from ( 'zeroshot release smoke\n' ) ;
895+
896+ function smokeExecutable ( binaryPath , failureCode ) {
897+ const directory = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'zeroshot-rust-executable-smoke-' ) ) ;
898+ try {
899+ fs . writeFileSync ( path . join ( directory , 'greeting.txt' ) , SMOKE_GREETING ) ;
900+ const result = childProcess . spawnSync ( binaryPath , [ '--native-validate-greeting' ] , {
901+ cwd : directory ,
902+ input : SMOKE_GREETING ,
903+ stdio : [ 'pipe' , 'inherit' , 'inherit' ] ,
904+ } ) ;
905+ if ( result . error ) throw result . error ;
906+ if ( result . signal || result . status !== 0 ) {
907+ throw new Error ( `${ failureCode } : status=${ result . status } signal=${ result . signal || 'none' } ` ) ;
908+ }
909+ } finally {
910+ fs . rmSync ( directory , { recursive : true , force : true } ) ;
911+ }
912+ }
913+
906914if ( require . main === module ) {
907915 try {
908916 run ( ) ;
@@ -926,6 +934,7 @@ module.exports = {
926934 packageTarget,
927935 parseChecksumManifest,
928936 sha256,
937+ smokeExecutable,
929938 targetForHost,
930939 stageVersion,
931940 targets,
0 commit comments