@@ -121,9 +121,10 @@ function ros2Run(packageName, executableName, args = []) {
121121 childProcess . on ( 'error' , ( error ) => {
122122 reject ( new Error ( `Failed to start ros2 run: ${ error . message } ` ) ) ;
123123 } ) ;
124-
125- resolve ( {
126- process : childProcess ,
124+ childProcess . on ( 'spawn' , ( ) => {
125+ resolve ( {
126+ process : childProcess ,
127+ } ) ;
127128 } ) ;
128129 } ) ;
129130}
@@ -157,8 +158,10 @@ function ros2Launch(packageName, launchFile, args = []) {
157158 reject ( new Error ( `Failed to start ros2 launch: ${ error . message } ` ) ) ;
158159 } ) ;
159160
160- resolve ( {
161- process : childProcess ,
161+ childProcess . on ( 'spawn' , ( ) => {
162+ resolve ( {
163+ process : childProcess ,
164+ } ) ;
162165 } ) ;
163166 } ) ;
164167}
@@ -526,9 +529,7 @@ let rcl = {
526529 * @param {string[] } [args=[]] - Additional arguments to pass to the executable.
527530 * @return {Promise<{process: ChildProcess}> } A Promise that resolves with the process.
528531 */
529- ros2Run ( packageName , executableName , args = [ ] ) {
530- return ros2Run ( packageName , executableName , args ) ;
531- } ,
532+ ros2Run : ros2Run ,
532533
533534 /**
534535 * Run a ROS2 launch file using 'ros2 launch' command.
@@ -537,9 +538,7 @@ let rcl = {
537538 * @param {string[] } [args=[]] - Additional arguments to pass to the launch file.
538539 * @return {Promise<{process: ChildProcess}> } A Promise that resolves with the process.
539540 */
540- ros2Launch ( packageName , launchFile , args = [ ] ) {
541- return ros2Launch ( packageName , launchFile , args ) ;
542- } ,
541+ ros2Launch : ros2Launch ,
543542} ;
544543
545544const _sigHandler = ( ) => {
0 commit comments