shell


    Oct 25 2018 | 1:18 pm
    This first post will always contain a link to the latest version of shell.
    Shell is a cross-platform object for Max with which you can execute terminal commands. The shell object spawns a new shell process, executes the desired commands and passes stdout (and optionally stderr) back to Max. Latest version: https://github.com/jeremybernstein/shell/releases/tag/1.0b3 Release notes (1.0b3): - escape backslashes in output - arm64 (Apple Silicon) fat binary on macOS - 32-bit version removed on macOS - this is the final release with a 32-bit external for Windows
    Release notes (1.0b2): - OSX: @forkmode now permits switching between fork (default, SSH-compatible) and vfork (better performance under some circumstances) - OSX: SSH works again (if using fork(), see above) - Windows: fixes for single-byte code pages on non-ANSI systems - Windows: Fix for incomplete (prompt) output for Unicode commands. Release notes (1.0b1): - c++11 rewrite (no functional change) - OSX: change fork() to vfork() to improve performance and minimize interruption when forking. - OSX: reset signal masks in the forked process - update Windows projects for Visual Studio 2015

    • Dec 31 2018 | 2:38 pm
      Thanks for keeping this object alive Jeremy, was just wondering why some of my old patches weren't working until I figured out that aka.shell didn't support 64-bit CPUs.
      Anyway, thought I'd point out that I came across this page via https://cycling74.com/tools/bernstein-shell/ which links to the old forum thread first. Nearly downloaded the 2017 version until I decided to skim through the whole page first and found the link to here. Might be worth updating the links :)
    • Dec 31 2018 | 4:49 pm
      thanks for the note, I've updated the link on the tool page.
    • Jan 08 2019 | 9:57 am
      Does anyone know how to close/quit a specific application or file that is currently open? Via shell (or otherwise if possible).
      I'm on windows and I'm able to open the file or application via shell by just sending the directory of it to shell, but would like to be able to close it as well. Tried pkill but that does not seem to take extra arguments.
      Any ideas?
      Thanks.
    • Jan 09 2019 | 8:11 am
      taskkill or tskill is windows equivalent of unix pkill
      To forcefully kill only this process
      taskkill /IM SomeApp.exe /F To forcefully kill this process and any child processes started by it taskkill /IM SomeApp.exe /T /F
    • Jan 10 2019 | 8:20 pm
      Thank's for this beautiful object ! On os x 10.13 ssh doesn't work (on my computer) but on my other computer 10.9 it works fine any ideas ? Thank's
    • Jan 28 2019 | 12:19 pm
      Thanks for the great and highly useful shell object. On Win 10, shell.mxe64 (as of Oct 25 2018) in Max8.0.2 cannot be used on systems set to Asian languages when commands return Asian characters, though. For example on Korean systems: $ ipconfig /all crashes Max reliably as the returned data contains Korean characters. The 20170717 shell version behaves the same, as does shell.2018 on Japanese localizations. Looking into this would be highly appreciated.
      Thanks!!
    • Feb 14 2019 | 6:21 am
      Hi all, Did anyone on Windows try to control other programming languages from the new shell object?
      I develop a pedagogical package called MOZLib, dedicated to computer aided composition and that works as an introduction to the bach & cage packages A big part of it uses SBCL (www.sbcl.org/platform-table.html) to reactualize composition techniques developed on PatchWork, OpenMusic and PWGL in the 1980s-2000s. It work beautifully on Mac, but I never had the occasion to test it on PC since Windows 10.
      If someone is interested to give me a hand with this, it would be fantastic. I'm planning for a first release around April.
      Thanks,
      Julien
    • Feb 14 2019 | 8:18 am
      Anyone on OSX who is having SSH issues, please try this version: https://expr-i0.net/shell_ssh.zip
      There is a new attribute @forkmode. For the previous release, shell was forking with 'vfork' in order to eliminate CPU spikes encountered in (for instance) Live when executing certain kinds of scripts. 'vfork' is useful for this, but disables SIGTTOU and SIGTTIN signals in the child process which are used for interactive input in ssh. You can now select either 'fork' (default, works with ssh) or 'vfork' (less overhead when forking, won't work for ssh), and because it's an attribute, you can change it on the fly depending on your needs.
      For in-box usage, @forkmode 0 = fork, @forkmode 1 = vfork.
      This is OSX-only (the attribute is invisible on Windows and has no effect). If I can get some feedback, I'll roll the changes into an updated release above.
    • Feb 15 2019 | 9:35 am
      Coming back to the difficulties using shell on Win10 with Asian character sets which should be resolved asap. Setting Win10 to e.g. Korean (and back) is just 2 steps: - in Win10 Settings/Time&Language, select Region&language, click Add a language, select Korean, in the Korean field click the Options button and DL the typing pack, click Set as default - right-click the Start menu, open Powershell in Admin mode, type "Set-WinSystemLocale ko-KR" - reboot - in command type e.g. "ipconfig /all"; you should see Asian characters in the output - open shell.maxhelp and send the same command, over here Max8 crashes - to get back to English: in Win10 Settings select English, click Set as default - open Powershell in Admin mode, type "Set-WinSystemLocale en-US" - reboot Thanks for setting this straight.
      Torsten
    • Feb 15 2019 | 9:42 am
      Torsten, it's a free, unsupported and (if you want to try figuring it out yourself) open-source external. I certainly understand your frustration, but it will be resolved when there's time to devote to setting up a system for korean and figuring out the problem. A much more common and pressing issue -- broken SSH on OSX -- took a couple of months to get around to, so thanks for your patience.
      That all said, thanks for the reproduction steps, which will help with the above. Not sure when I'll be able to look at it, though.
    • Feb 15 2019 | 9:51 am
      Sure, perfectly understood. Thanks again for the great object and your support.
    • Feb 19 2019 | 1:59 pm
      @torsten, please test https://expr-i0.net/shell_win_190219.zip and let me know how it goes. Turned out to be a pretty annoying issue involving non-Unicode, single-bytes Windows code pages (charsets). Seems to be working for me now.
    • Feb 19 2019 | 3:25 pm
      Tested shell_win_190219.mxe64 on Win10. - shell works on en-US system as before - when set to ko-KR (Korean) as described above shell processes Asian characters without the slightest hitch - tested commands: ipconfig /all, arp -a, getmac, ping /n 1 localhost
      Thanks, Jeremy!
      - of no significance, just for the record, sending the command "date" to shell prints the output twice; then shell does not react to any further commands. Same behavior on both Win10 en-US and ko-KR. And same behavior as in the previous (1.0b1) version of shell.
    • Feb 19 2019 | 3:54 pm
      @torsten, good call on 'date', there was a bug in handling incomplete (e.g. prompt) lines in Unicode output. Will be fixed in the next one, which will be posted to github momentarily.
    • Feb 28 2019 | 11:01 pm
      Long shot, but did anyone figure out how to use virtual environment with Python under shell?
    • Apr 26 2019 | 11:03 am
      I've been trying to trigger some npm code which works fine in Terminal, but I get no response in shell. Might there be some issue where I have to load dependencies or something (it works from scratch in Terminal)?
    • May 31 2019 | 7:31 pm
      how would I form a message if I need to send my user password to shell? RTFM link is fine, too.
    • Jun 01 2019 | 6:09 am
      example on OSX echo 'pass' | sudo -S mkdir ~/AAA
      That will make folder named AAA on desktop with admin pass pass is Your password | between pass and sudo is vertical slash , ascii 124
    • Jun 01 2019 | 9:43 am
      thanks, creating a directory works. would you know why this doesn't work for me: echo 'password' | sudo spctl --master-disable i also tried: sudo spctl --master-disable and then in a separate message: echo 'password'
    • Jun 01 2019 | 12:00 pm
      try : echo 'pass' | sudo -S spctl --master-disable
    • Jun 01 2019 | 12:06 pm
      didnt work
    • Jun 06 2019 | 1:49 pm
      I had no High Sierra at hand to confirm that above message to shell works, but now I tested it and it works as expected. Enabling / disabling gatekeeper works. So You must have some other problem. I used last published shell version at the top of this thread.
    • Jun 06 2019 | 2:37 pm
      ok good to know. i will find it eventually. it'll just take some time as i am a terminal dork. i will report my findings.
    • Jun 06 2019 | 2:43 pm
      Maybe You have system integrity protection (SIP) enabled ? You can test things using Terminal first, and if it works there, than it should also in shell.
    • Jun 06 2019 | 2:47 pm
      helvete-6:~ pureold$ csrutil status System Integrity Protection status: enabled.
      'spctl --master-disable' alwaysworks in the terminal but not through shell. I haven't found the right way to send my pwd and 'spctl --master-disable' in one message to the shell.
    • Jun 06 2019 | 3:07 pm
      if password is AAA123
      echo 'AAA123' | sudo -S spctl --master-disable
      This works for me
    • Jun 06 2019 | 3:37 pm
      this is precisely what doesn't work for me. that's my problem
    • Jun 06 2019 | 4:01 pm
      I can't explain it, I do have SIP disabled though, but I don't think that turning gatekeeper off requires SIP to be disabled.
    • Jun 07 2019 | 6:39 am
      This is working for me, and is no different than what you're trying to do.
      $ csrutil status
      System Integrity Protection status: enabled.
    • Jun 07 2019 | 7:59 am
      What has to be mentioned is that if one sends sudo message to shell without providing the password, shell will wait forever for the password input, and will not execute any commands. One has to close and reopen patch, sometimes even restart max to get it going again. To confirm that password is set correctly send this to shell: echo 'pass' | sudo -S whoami ( put correct password in) should output root message whoami should output user name ---------- Is the password the problem ? Try temporary changing the password to something simple, like a single letter, just to make sure, and avoid spaces. And don't use terminal and max with shell at same time. sudo -K command can be used in terminal to clear password cache which gets stored after initial entry for a limited time. Don't know what else to suggest to troubleshoot the problem
    • Aug 09 2019 | 2:52 pm
      Hi Jeremy! Great work with this shell object! Really saved my day :) I would simply suggest an update: adding alias. I was trying to run this in order to test something like firmware updates directly from a Max patch. Using the alias method on the shell was simply not reacting (no errors, but also not uploading the arduino file). I was able to do it replacing the alias with the file path. Although this is fine for me, I can imagine some people running into troubles if they have huge file paths for their implementations. Anyway...great job! Thank you
    • Aug 09 2019 | 8:21 pm
      Hi, every time you send a command to 'shell', it's creating a new login shell, so you don't have persistence (or crosstalk, if you like) between invocations. You can probably add that alias to your .bashrc such that it works every time you use 'shell', although I haven't tested it. Glad the object is working for you!
    • Sep 08 2019 | 1:51 pm
      Hello, I'm trying to launch some Processing patches via the shell object using the command line installation of Processing. However, the shell object shows no reaction to the command "processing-java" or to full commands like "processing-java --sketch=<filepath> --run". It also didn't print anything in reaction to "processing-java --help". All other commands have been working fine ("echo", "pwd", etc. all printed expected results). The workaround that I thought of was to store the processing launch command in a .sh file, and launch the .sh via the shell object, but I can't seem to get any .sh files to launch either. Any recommendations on what to look into? Is this even possible via the shell object? This object has otherwise served me very well in the past! Thanks
      EDIT-September 9: Okay, I think the main issue was message formatting in Max. I've gotten shell to successfully launch shell scripts by opening them in Terminal. (open -a Terminal \"<path-to-.sh-file>\") passed as a message into shell opens a terminal window and runs the script. Not a perfect solution but it works. Another possibility is to export all of the Processing sketches as applications, and launch them using the "open" command in a similar way.
    • Oct 24 2019 | 8:44 am
      HI Jeremy- i am trying to us the shell object to convert some video files automatically in Max - and when i feed the following line into a terminal window (on a mac) - it works fine - but when i try this ins MAX then i get no response - and for the life of me i cant figure out why... does shell not work with ffmpeg? or is there some other reason that i just dont see? i am passing the following line as a message to the shell object: ffmpeg -i /Users/OP/Desktop/Top_View_Camera/20191024_S3_EQ_OHD_Trial01.mkv -vcodec copy -acodec copy /Users/OP/Desktop/Top_View_Camera/20191024_S3_EQ_OHD_Trial01.mp4 any suggestions are greatly appreciated ! thx
      Matthias
    • Oct 24 2019 | 8:50 am
      send full path to ffmpeg binary to shell. And use slash based path.
    • Oct 24 2019 | 11:07 pm
      Thank you Source Audio! ;) solved my problem! ;) greatly appreciated!!
    • Oct 29 2019 | 9:30 am
      now i do have another question that i cant seem to solve: shell is calling a new terminal session each time a message is sent to it - i get that -this means that i cant call a for loop in terminal as a usually would since each line would call a new terminal. if i want to convert the above mentioned mkv videos to Mp4 videos - then i was thinking i could (since the number of videos created will vary dependent on the numbers of trials) read the folder with the folder object and then selected ONLY the mkv flies to process - but i cant seem to find how to filter the list only to *.mkv - the selectable type does not include mkv file - so how do i just search for a text tring and use that as filter ? the individual names of the file wikll change of course - so i want to pass each individual file name to the shell object for conversion via ffmpeg. what am i missing?
      thx
      Matthias
    • Oct 29 2019 | 10:16 am
      You need to add .mkv filetype to Max filetypes in order to be able to filter that type of file in umenu autopopulate, dropfile filetype etc. Either add a line in max-fileformats.txt which is the best option, max fileformat .mkv MKVF 0 Video moviefile; or by loadbanging a message : ; max fileformat .mkv MKVF What I don't know what 4 char id should be used for that type of file, maybe MKVF would do. Adding a line in max-formats.txt is a better option, because it will work form the first max start. Doing this by message from max standalone, would need standalone restart to make new filetype active.
    • Oct 29 2019 | 10:18 am
      P.S. of course You could build a full list of found items, and then copy only *.mkv files to a new list, doing some regex or similar, but that's not prefered way.
    • Oct 29 2019 | 10:19 am
      Hey Source Audio - great - did not know that i could edit the list of file types - i will try that! ;)
      thX
    • Nov 02 2019 | 7:03 pm
      Another simpler question.... how to send the press ENTER request appearing in the max Console?? penter alone doesn't work... Thx - Italo
      penter
    • Nov 03 2019 | 8:22 am
      penter needs a password entered. man perl needs no password . I don't know what exactly You are trying to do. If You send any message that requests password, You send penter xy, xy = password.
    • Nov 03 2019 | 11:38 am
      @keepsound 'penter' is working for me with the perl docs, or man pages in general.
    • Nov 03 2019 | 10:07 pm
      Hi, first of all, many thanks for your answers and interest. @source audio: I don't have to send passwords and I know how to do it. Here I have only to send ENTER (I guess penter, and it's not working. I'm not speaking about Pearl but about Man and what is then coming out to the Max Console @Jeremy: penter alone is not working for me with man (I've write man Pearl as example, can be any, man cp, man mkdir, man rm etc). In the Terminal window the info is complete, in Max you have to send ENTER to show the next row.
      Most of all I need a url with more infos about penter, but there's not any....
    • Nov 04 2019 | 2:05 am
      Found by myself, maybe can be useful for anyone: send a argument to the shell obj as "stderr 1", then penter will work. See picture
    • Nov 04 2019 | 10:15 am
      Fine that it finally works for You. I am using older version of shell (2017) max and OS. It works differently than new one, and also depends on OS. So as You say, one has to try & error till it does what one wants.
    • Nov 04 2019 | 12:26 pm
      Yes, you can download the new vers too. The new vers is 8.0.0 and works also on older Max and OS versions.
    • Jan 09 2020 | 11:41 pm
      I am trying to retrieve the name of the wifi network i am connected with through [shell]. this command works in the terminal: /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}' sending this message into the shell object gives me back "0". does anyone know what I am doing wrong?
    • Jan 10 2020 | 7:54 am
      Try this :
    • Jan 10 2020 | 8:29 am
      @source audio your patch gives me this: print: agrCtlRSSI: print: agrExtRSSI: print: agrCtlNoise: print: agrExtNoise: print: state: print: op print: lastTxRate: print: maxRate: print: lastAssocStatus: print: 802.110000 print: link print: BSSID: print: SSID: print: MCS: print: channel: but no info. OSX 10.13.4 i am connected to an android 6 phone hotspot right now. will try at home later.
    • Jan 10 2020 | 8:39 am
      I am having clear output with all values, but I run it on snow leopard.
    • Jan 10 2020 | 8:57 am
      you are on 10.6??? wow.... it seems that [shell] is often not accepting the same messages as the terminal although it is supposed to do so. is there any place where i can read/learn about this?
    • Jan 10 2020 | 9:02 am
      • Thanks again for the great object and your support.
    • Jan 10 2020 | 9:13 am
      /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print \$2}' works for me. You need to escape the $ in $2 because $2 is a reserved term in message box.
    • Jan 10 2020 | 9:16 am
      sending "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I" in the terminal gives me all the info
    • Jan 10 2020 | 9:19 am
      "success"!!!! i found an older [shell] from 17 july 2017 (version 7.3.4) which does work! let's hope we caught jeremy's attention by now to get a fix or at least an explanation =)
    • Jan 10 2020 | 9:24 am
      @jeremy - read your post too late.... i tried with shell 8.0.0 and it works! thanks for the help.
      can the same thing be done with shell on windows? probably needs a completely different message?
    • Jan 10 2020 | 9:28 am
      OK, the problem in @Source Audio's patch is that shell outputs its result as a list (it used to output each line as a single symbol in the past, you can re-enable that behavior with the @symout). So the data is being altered by fromsymbol (which only reads the first item in the list and ignores the 2nd item (the name you want)).
      The awk issue is the escaped $, as I mentioned earlier.
      So this works for me, and should work for you:
      As for Windows, well, that's what the internet's for, right? I used an obscure tool called Google and found: https://superuser.com/questions/1124659/how-can-i-use-cmd-to-find-out-to-which-wifi-network-i-am-connected/1124661 . You'll need to try it yourself, though.
    • Jan 10 2020 | 9:35 am
      yeah - i just figured out the tosymbol trap in source audio's patch this very second. google is indeed an interesting tool. thanks for bringing it to my attention. will give it a try soon and report back if it's useful for anything at all!
    • Jan 10 2020 | 9:48 am
      What makes it a bit difficult is that both shell version and OS version come into play, so one needs to experiment a bit to get the wished result. Inserting print or capture is allways helpfull to find out what's going on. in older shell escaping \$2 simply does not work ...
    • May 23 2020 | 10:43 pm
      Hi,
      This is a question mostly for Jeremy, but anyone who has an idea is very welcome ! As I wrote already before on this page I use the shell object intensively for 5 years now, to evaluate Lisp code generated on the fly in Max (+ bach) with SBCL. It works beautifully (and extremely fast), thank you so much again Jeremy for keeping the project alive, I really depend on it ! :) Now the system I call PWforMax is part of my main research project, and distributed freely inside the MOZ'Lib package for computer-aided / algorithmic composition : http://julienvincenot.com/?page_id=235 My question concerns performance of the shell object when printing from stdout and/or stderr to the Max window. I am now porting to Max a powerful, polyphonic music constraint solver (written in Lisp by Örjan Sandred) that in a certain debug/verbose mode prints every n cycles of a search to stdout. This is very useful to identify where and why the solver would struggle to return a result with specific search-space and rules. I noticed in that case that the shell object seems to struggle and return those printed messages kind of all at the same time (by grapes of 60 lines every 5 to 15 seconds), sometimes it even waits until the end of evaluation before returning anything. In pure lisp, from the terminal, it prints everything at constant pace, which is a bit more readable.
      Any idea why? I imagine this might be a "feature" or voluntary limitation (like a speedlim...) in the bridge between Max and shell? This is very much a cosmetic problem, it looks clunky but does the job VERY well :)
      Thanks for the help ! All the best,
      Julien
    • Nov 29 2020 | 2:58 pm
      Hi again Jeremy! On macos I'm noticing a particular anomaly. After sending a command to the shell at the start of a patch of max to start a program, when I try to save the same max file that I am working on and which contains the shell module it does not make me save the max file in the same folder but redirects it to another directory automatically. Surely this is not a bug but it is my problem of little knowledge of the terminal. Do you know how to solve this problem? Thanks
    • Nov 29 2020 | 5:26 pm
      The normal place to save some files is the preferences folder of the app itself, located in the library/application support/name_of_the_folder_that_you_give_it_preferences....path to rename in the standalone obj of your project. And it’s better you give it a name, otherwise the folder will created inside the Cicling’74 preferences folder and overwrite others (that should not be present...). My 2 cents...
    • Nov 29 2020 | 5:28 pm
      ...and don’t save inside your bundle, otherwise the app can’t be notharized.
    • Nov 29 2020 | 8:51 pm
      @mma I'm not sure I understand your report. You mean, when you try to save the patcher, the Save As... dialog is opening to a folder you're not expecting? Or you mean you are choosing Save, and Max is automatically saving a copy of the file to a different location than the file you're saving? I honestly have no idea what would cause the latter, and would need to see a patcher exhibiting it. If it's the former, I might have some ideas, but I'd probably still need a patcher.
    • Nov 30 2020 | 8:47 pm
      Friends, there is an AppleScript
      tell application "System Events" set the props to get the properties of the front window of application process "Finder" set theSBounds to {size, position} of props end tell
      please help to execute it and get the data using the shell
    • Dec 01 2020 | 12:07 am
      finder is a coreservice but it should work the same way as it does for applications https://unix.stackexchange.com/questions/43106/how-to-set-window-size-and-location-of-an-application-on-screen-via-command-line
    • Dec 01 2020 | 7:59 am
      that is not apple script. You can't simply write any gibberish into script. From what you posted one can not even get idea what you want to achieve with it. If you only wrote in plain text something like : I want to tell finder to change position of it's frontmost window... if you have working apple script, next burden is convert that into osascript formated shell message, including all max created traps because of escaping chars, etc etc here is one example to get you on the right path:
    • Dec 01 2020 | 8:23 am
      @КОНСТАНТИН КАЗАНЦЕВ: this works from the Terminal
      $ osascript -e 'tell application "System Events"' -e 'set the props to get the properties of the front window of application process "Finder"' -e 'return {size, position} of props' -e 'end tell'
      > 997, 570, 206, 67
      and in fact, this Max patcher works for me:
    • Dec 01 2020 | 11:17 am
      @mma there are a few objects in this patcher which I don't have:
      newobj: auto_restart-sleep: No such object newobj: dsp_state: No such object newobj: send_osc: No such object newobj: init_audio_interface: No such object
      and I have no idea what I'm supposed to do to reproduce the problem. Can you try to reduce it an absolute minimum and add instructions?
    • Dec 01 2020 | 12:07 pm
      auto_restart-sleep contains the curtain object; dsp_state, send_osc, init_audio_interface I did not include them voluntarily to have a focus on the subpatch that contains the shell object ..
    • Dec 01 2020 | 2:27 pm
      @JEREMY: Thank you very much, now it works very well. I am very grateful to you!!!! The shell object really needs detailed instructions and a large help file.
    • Jan 04 2021 | 9:10 pm
      @Jeremy
      Hello ! With a collaborator we're trying to get UNIX applications (SBCL lisp implementation) to be controlled by Max in Windows 10 through the "Windows Subsystem for Linux" (WSL), as is already possible on Mac very easily (see my posts on MOZLib above)
      We managed to run SBCL unix executable after unlocking WSL (on Ubuntu terminal as shown in screen shot). Now what we can't figure out is if the Windows version of the shell object would allow to interact with that Unix layer, or if it only has access to the PowerShell "layer" and syntax.
      Unfortunately the help file available doesn't provide much info on the distinction between Mac shell (Unix) and Windows shell (PowerShell or Unix), so we could really use some of your guidance here :)
      Thanks in advance for your help ! Julien
    • Jan 04 2021 | 9:14 pm
      @Jeremy
      Hi, I'm following what Julien just posted. Here are two screenshots to better explain where we're stuck:
      sbcl runs fine on the windows machine
      sbcl runs fine on the windows machine
      as I try to launch it from the shell object nothing happens
      as I try to launch it from the shell object nothing happens
      Thanks in advance!
    • Jan 04 2021 | 9:47 pm
      The Windows shell is CMD, not PowerShell at the moment.
    • Jan 07 2021 | 3:29 am
      Hi Jeremy Thanks for the fast reply, that clarifies our first misunderstanding. I don't have a Windows machine with me to verify it, but my next best guess is using the "wsl" prefix command to interact indirectly with the Unix shell — supposedly it works from both classic CMD and PowerShell. If you have any other idea that might help, I'm very interested ! I might come back to you after we test things out with Matteo. Thanks again ! Best
    • Jan 09 2021 | 10:23 pm
      Hi
      I am struggling with [shell] on windows 10.
      I want to start ultragrid (a video streaming CLI app -> ultragrid.cz) with [shell], which works just fine.
      but I am struggling with stopping it. 'pkill' will stop the process to output data to the max-console, but the process keeps running in the background.
      while it is possible to kill it with 'taskkill /IM uv.exe /F', without knowing the processid it will kill all running ultragrid processes. And I need to run multiple of those processes (each inside its own [shell] objects).
      I wonder if there is a way to get the process id when starting a process within [shell]. Or any other way to achieve my goal.
      cheers
    • Jan 10 2021 | 9:04 am
      Never attempt to do that in win, but in osx yes... I think the system is perhaps the same, the cmd should be different, You can take inspiration....
    • Jan 10 2021 | 9:16 am
      tasklist ?
    • Jan 10 2021 | 10:47 am
      @sourceaudio: with tasklist I get the PID from all the task, but I need the one I started inside the [shell].
      @keepsound: does this patch also work with windows 10?
    • Jan 10 2021 | 12:10 pm
      You should maybe get more precise about that "different" processes. Are You starting same exe several times ? Why don't you simply duplicate and rename the exe file ? uv1.exe, uv2.exe etc
    • Jan 10 2021 | 12:15 pm
      Are You starting same exe several times ?
      yes, thats the idea.
      Why don't you simply duplicate and rename the exe file ? uv1.exe, uv2.exe etc
      not the most elegant, but that's actually workable hack, thanks :-)
    • Jan 10 2021 | 12:28 pm
      Talking about elegant way, why don't you control that one exe in a better way ? Is is it not able to provide and control multi streams ? Don't know much about that app that you use, but I would first check if that is possible.
    • Jan 10 2021 | 12:40 pm
      Don't know much about that app that you use, but I would first check if that is possible.
      I need to run it in different processes.
    • Jan 10 2021 | 1:25 pm
      Don't have win machine at hand now to test , but remeber start process command like start "Stream1" path and parameters start "Stream2" path and parameters etc then : taskkill /FI "WindowTitle eq Stream1*" /T /F taskkill /FI "WindowTitle eq Stream1*" /T /F Could you try that ? You also have option to write scripts and run them from max using launchbrowser messages just an idea
    • Jan 10 2021 | 4:31 pm
      Thanks - That would work. However, the ultragrid-CLI outputs status messages I would like to parse, and running it inside the [shell] I can get them to parse inside max, while using 'start' opens a new 'cmd' window where they are unreachable.
      I am tinkering with 1. copy uv.exe uv0.exe 2. uv0.exe <parameters> 3. pkill 3. taskkill /IM "uv0.exe" /F 4. del uv0.exe
      where each instance will get its own index. but it is not ideal either.
    • Jan 11 2021 | 8:29 am
      I would keep copies of the exe file, why copy and delete ?
      You can also try to capture log events into max, I am not sure if shell can deal with it, last I remember is powershell get-eventlog, but maybe there are options for cmd based event capture, like wevtutil.exe - is that one still arround on windows 10 ?
    • Jan 18 2021 | 11:04 am
      Hi This is a follow-to my message posted here in May 2020 about how slow shell prints stdout / stderr during longer evaluations. I encountered this problem clearly today when running this constraint solver in Lisp. I took a video to demonstrate the problem, I will leave it on google drive : https://drive.google.com/file/d/1K8NCHktKNCj9RBnBgnnG8wd2sQ7Qu5yK/view?usp=sharing
      I realized it slows down Max dramatically, even if its output is connected to nothing. As you see the sbcl process is not so heavy in the terminal, I cannot understand why it would become so unstable in Max, as most of the calculations happen in the SBCL process.
      Do you have any idea of how I could solve this? Of course I am available if you want to do some live testing on Zoom or else. thanks !
      Julien
    • Jan 22 2021 | 9:51 am
      Hi @Julien, maybe you can post a complete patcher with setup instructions. I suspect this is just an interaction with the Max Console. As you mentioned, the actual work is happening in a different process.
    • Jan 22 2021 | 10:02 am
      Hi Jeremy,
      Of course, is there a way to reach you directly to send you the files? It requires a package that is not completely ready for release. Otherwise I need a little more time to reproduce it more lightly, let me know. Thanks !
    • Jan 22 2021 | 10:11 am
      jeremy at cycling74 dot com
    • Jan 22 2021 | 10:13 am
      Thanks ! I'll prepare the example
    • Feb 04 2021 | 10:08 am
      hi Im on mac os mojave. trying the command "pkill -x TextEdit" for instance, and it doesnt work, while working from Terminal. console say extra arguments for message "pkill" Do i miss something? thx!