From 80b7f2f3d7186633e3e26a799b1db05d5c951da9 Mon Sep 17 00:00:00 2001 From: Avery King Date: Wed, 5 Jul 2023 13:31:22 -0700 Subject: [PATCH] mod-script-pipe: Rename pipe name Scripts that communicate with Tenacity now need to be updated to use the new pipe name, 'tenacity_script_pipe.{to,from}.{pid}'. This should also prevent conflicts if Audacity's pipe server is running at the same time with Tenacity's pipe server. Signed-off-by: Avery King --- modules/mod-script-pipe/PipeServer.cpp | 2 +- scripts/piped-work/docimages_core.py | 4 ++-- scripts/piped-work/get_gui_structure.py | 4 ++-- scripts/piped-work/pipe_test.pl | 12 +++++++----- scripts/piped-work/pipe_test.py | 4 ++-- scripts/piped-work/pipeclient.py | 2 +- scripts/piped-work/recording_test.py | 4 ++-- tests/octave/run_test.m | 4 ++-- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/mod-script-pipe/PipeServer.cpp b/modules/mod-script-pipe/PipeServer.cpp index 4d3066f39..47a77cfa0 100644 --- a/modules/mod-script-pipe/PipeServer.cpp +++ b/modules/mod-script-pipe/PipeServer.cpp @@ -114,7 +114,7 @@ void PipeServer() #include #include -const char fifotmpl[] = "/tmp/audacity_script_pipe.%s.%d"; +const char fifotmpl[] = "/tmp/tenacity_script_pipe.%s.%d"; const int nBuff = 1024; diff --git a/scripts/piped-work/docimages_core.py b/scripts/piped-work/docimages_core.py index 51ff40d75..961f47aec 100644 --- a/scripts/piped-work/docimages_core.py +++ b/scripts/piped-work/docimages_core.py @@ -19,8 +19,8 @@ def startPipes() : EOL = '\r\n\0' else: print( "pipe-test.py, running on linux or mac" ) - toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid()) - fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid()) + toname = '/tmp/tenacity_script_pipe.to.' + str(os.getuid()) + fromname = '/tmp/tenacity_script_pipe.from.' + str(os.getuid()) EOL = '\n' print( "Write to \"" + toname +"\"" ) diff --git a/scripts/piped-work/get_gui_structure.py b/scripts/piped-work/get_gui_structure.py index 5d35f70a2..d4a1d93cc 100644 --- a/scripts/piped-work/get_gui_structure.py +++ b/scripts/piped-work/get_gui_structure.py @@ -17,8 +17,8 @@ if( sys.platform == 'win32' ): EOL = '\r\n\0' else: print( "get-gui-structure.py, running on linux or mac" ) - toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid()) - fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid()) + toname = '/tmp/tenacity_script_pipe.to.' + str(os.getuid()) + fromname = '/tmp/tenacity_script_pipe.from.' + str(os.getuid()) EOL = '\n' print( "Write to \"" + toname +"\"" ) diff --git a/scripts/piped-work/pipe_test.pl b/scripts/piped-work/pipe_test.pl index 9781a7e8f..ae658a0e1 100644 --- a/scripts/piped-work/pipe_test.pl +++ b/scripts/piped-work/pipe_test.pl @@ -33,12 +33,12 @@ if ($^O eq 'MSWin32') { $FromSrvName = '\\\\.\\pipe\\From'.$Name.'Pipe'; } elsif ($^O eq 'linux') { $UID = $<; - $ToSrvName = '/tmp/audacity_script_pipe.to.'.$UID; - $FromSrvName = '/tmp/audacity_script_pipe.from.'.$UID; + $ToSrvName = '/tmp/tenacity_script_pipe.to.'.$UID; + $FromSrvName = '/tmp/tenacity_script_pipe.from.'.$UID; } elsif ($^O eq 'darwin') { $UID = $<; - $ToSrvName = '/tmp/audacity_script_pipe.to.'.$UID; - $FromSrvName = '/tmp/audacity_script_pipe.from.'.$UID; + $ToSrvName = '/tmp/tenacity_script_pipe.to.'.$UID; + $FromSrvName = '/tmp/tenacity_script_pipe.from.'.$UID; } # Open pipes @@ -74,7 +74,9 @@ sub stopTiming{ sub sendCommand{ my $command = shift; if ($^O eq 'MSWin32') { - print TO_SRV "$command \r\n\0"; + print TO_SRV "$command + +\r\n\0"; } else { # Don't explicitly send \0 on Linux or reads after the first one fail... print TO_SRV "$command\n"; diff --git a/scripts/piped-work/pipe_test.py b/scripts/piped-work/pipe_test.py index 47cf6d57c..f33586ace 100644 --- a/scripts/piped-work/pipe_test.py +++ b/scripts/piped-work/pipe_test.py @@ -25,8 +25,8 @@ if sys.platform == 'win32': EOL = '\r\n\0' else: print("pipe-test.py, running on linux or mac") - TONAME = '/tmp/audacity_script_pipe.to.' + str(os.getuid()) - FROMNAME = '/tmp/audacity_script_pipe.from.' + str(os.getuid()) + TONAME = '/tmp/tenacity_script_pipe.to.' + str(os.getuid()) + FROMNAME = '/tmp/tenacity_script_pipe.from.' + str(os.getuid()) EOL = '\n' print("Write to \"" + TONAME +"\"") diff --git a/scripts/piped-work/pipeclient.py b/scripts/piped-work/pipeclient.py index 4d183d0c8..973f6d761 100755 --- a/scripts/piped-work/pipeclient.py +++ b/scripts/piped-work/pipeclient.py @@ -87,7 +87,7 @@ if sys.platform == 'win32': EOL = '\r\n\0' else: # Linux or Mac - PIPE_BASE = '/tmp/audacity_script_pipe.' + PIPE_BASE = '/tmp/tenacity_script_pipe.' WRITE_NAME = PIPE_BASE + 'to.' + str(os.getuid()) READ_NAME = PIPE_BASE + 'from.' + str(os.getuid()) EOL = '\n' diff --git a/scripts/piped-work/recording_test.py b/scripts/piped-work/recording_test.py index 23e849283..14f2fd71e 100644 --- a/scripts/piped-work/recording_test.py +++ b/scripts/piped-work/recording_test.py @@ -62,8 +62,8 @@ if sys.platform == 'win32': EOL = '\r\n\0' else: print("recording-test.py, running on linux or mac") - PIPE_TO_AUDACITY = '/tmp/audacity_script_pipe.to.' + str(os.getuid()) - PIPE_FROM_AUDACITY = '/tmp/audacity_script_pipe.from.' + str(os.getuid()) + PIPE_TO_AUDACITY = '/tmp/tenacity_script_pipe.to.' + str(os.getuid()) + PIPE_FROM_AUDACITY = '/tmp/tenacity_script_pipe.from.' + str(os.getuid()) EOL = '\n' diff --git a/tests/octave/run_test.m b/tests/octave/run_test.m index 3496ddd7f..2be2ff8db 100755 --- a/tests/octave/run_test.m +++ b/tests/octave/run_test.m @@ -32,8 +32,8 @@ end global TMP_FILENAME; global EXPORT_TEST_SIGNALS; UID=num2str(getuid()); -PIPE_TO_PATH=strcat("/tmp/audacity_script_pipe.to.", UID); -PIPE_FROM_PATH=strcat("/tmp/audacity_script_pipe.from.", UID); +PIPE_TO_PATH=strcat("/tmp/tenacity_script_pipe.to.", UID); +PIPE_FROM_PATH=strcat("/tmp/tenacity_script_pipe.from.", UID); TMP_FILENAME=strcat(pwd(), "/tmp.wav"); EXPORT_TEST_SIGNALS = false;