Loading commands/filesystem/dd.cpp +61 −10 Changes for commands/filesystem/dd.cpp: 61 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <cerrno> #include <cstdio> #include <chrono> #include <algorithm> #include <unistd.h> #include <fcntl.h> Loading Loading @@ -126,6 +127,23 @@ namespace fresh { namespace cmd { bool convNotrunc=false,convSync=false,convNoerror=false; bool convFsync=false,convFdatasync=false; std::string status; // iflag=/oflag= (GNU): open flags, plus fullblock and the // *_bytes forms that make count/skip/seek count bytes int iOpenFlags=0,oOpenFlags=0; bool fullblock=false,countBytes=false,skipBytes=false,seekBytes=false; auto openFlag=[](const std::string &f,int &flags)->bool{ if(f=="dsync") flags|=O_DSYNC; else if(f=="sync") flags|=O_SYNC; else if(f=="direct") flags|=O_DIRECT; else if(f=="append") flags|=O_APPEND; else if(f=="nonblock") flags|=O_NONBLOCK; else if(f=="noatime") flags|=O_NOATIME; else if(f=="nofollow") flags|=O_NOFOLLOW; else if(f=="noctty") flags|=O_NOCTTY; else if(f=="directory") flags|=O_DIRECTORY; else return false; return true; }; for(int i=1;i<argc;++i){ std::string arg=argv[i]; Loading Loading @@ -185,6 +203,19 @@ namespace fresh { namespace cmd { return 1; } } }else if(key=="iflag" || key=="oflag"){ bool in=(key=="iflag"); for(const std::string &f : splitComma(val)){ if(openFlag(f,in ? iOpenFlags : oOpenFlags)) continue; if(in && f=="fullblock") fullblock=true; else if(in && f=="count_bytes") countBytes=true; else if(in && f=="skip_bytes") skipBytes=true; else if(!in && f=="seek_bytes") seekBytes=true; else{ std::cerr << "dd: invalid " << (in ? "input" : "output") << " flag '" << f << "'" << std::endl; return 1; } } }else if(key=="status"){ status=val; if(status!="none" && status!="noxfer"){ Loading @@ -199,7 +230,7 @@ namespace fresh { namespace cmd { int inFd=0; if(!ifPath.empty()){ inFd=open(ifPath.c_str(),O_RDONLY); inFd=open(ifPath.c_str(),O_RDONLY|iOpenFlags); if(inFd<0){ std::cerr << "dd: " << ifPath << ": " << strerror(errno) << std::endl; return 1; Loading @@ -208,8 +239,10 @@ namespace fresh { namespace cmd { int outFd=1; if(!ofPath.empty()){ int flags=O_WRONLY|O_CREAT; if(!convNotrunc) int flags=O_WRONLY|O_CREAT|oOpenFlags; // oflag=append implies not truncating (GNU recommends // conv=notrunc with it; truncating would defeat append) if(!convNotrunc && !(oOpenFlags & O_APPEND)) flags|=O_TRUNC; outFd=open(ofPath.c_str(),flags,0644); if(outFd<0){ Loading @@ -222,20 +255,23 @@ namespace fresh { namespace cmd { int rc=0; if(skip>0){ if(lseek(inFd,(off_t)(skip*ibs),SEEK_CUR)==(off_t)-1){ unsigned long long skipLen=skipBytes ? skip : skip*ibs; if(lseek(inFd,(off_t)skipLen,SEEK_CUR)==(off_t)-1){ // Non-seekable input (a pipe): fall back to reading and // discarding skip whole ibs-sized blocks. // discarding skipLen bytes. std::vector<char> tmp(ibs); for(unsigned long long i=0;i<skip;++i){ ssize_t n=fullReadRetry(inFd,tmp.data(),tmp.size()); while(skipLen>0){ size_t want=(size_t)std::min<unsigned long long>(skipLen,tmp.size()); ssize_t n=fullReadRetry(inFd,tmp.data(),want); if(n<=0) break; skipLen-=(unsigned long long)n; } } } if(seek>0){ if(lseek(outFd,(off_t)(seek*obs),SEEK_CUR)==(off_t)-1){ if(lseek(outFd,(off_t)(seekBytes ? seek : seek*obs),SEEK_CUR)==(off_t)-1){ std::cerr << "dd: cannot seek output: " << strerror(errno) << std::endl; if(inFd!=0) close(inFd); if(outFd!=1) close(outFd); Loading @@ -252,11 +288,25 @@ namespace fresh { namespace cmd { std::vector<char> pending; pending.reserve(obs); unsigned long long bytesRead=0; for(;;){ if(haveCount && blocksRead>=count) if(haveCount && !countBytes && blocksRead>=count) break; size_t want=ibuf.size(); if(haveCount && countBytes){ if(bytesRead>=count) break; want=(size_t)std::min<unsigned long long>(want,count-bytesRead); } ssize_t n=fullReadRetry(inFd,ibuf.data(),ibuf.size()); ssize_t n=fullReadRetry(inFd,ibuf.data(),want); // iflag=fullblock: keep reading until the block is full // (or EOF) -- a pipe otherwise hands out short reads while(fullblock && n>0 && (size_t)n<want){ ssize_t more=fullReadRetry(inFd,ibuf.data()+n,want-(size_t)n); if(more<=0) break; n+=more; } if(n<0){ std::cerr << "dd: reading '" << (ifPath.empty()?"stdin":ifPath) << "': " << strerror(errno) << std::endl; if(convNoerror){ Loading @@ -274,6 +324,7 @@ namespace fresh { namespace cmd { break; blocksRead++; bytesRead+=(unsigned long long)n; size_t useLen=(size_t)n; if((size_t)n==ibuf.size()) inFull++; Loading commands/shell/CMakeLists.txt +1 −0 Changes for commands/shell/CMakeLists.txt: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ target_sources(fresh PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/colon.cpp ${CMAKE_CURRENT_SOURCE_DIR}/umask.cpp ${CMAKE_CURRENT_SOURCE_DIR}/jobs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wait.cpp ${CMAKE_CURRENT_SOURCE_DIR}/trap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/case.cpp ${CMAKE_CURRENT_SOURCE_DIR}/exec.cpp Loading commands/shell/jobs.cpp +20 −8 Changes for commands/shell/jobs.cpp: 20 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -25,13 +25,13 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ // "jobs [-p|-l]": fresh has no "&" backgrounding at all, so there is never // anything to report -- always succeeds with empty output, which is exactly // correct real-shell behavior when a shell genuinely has no background jobs. // Exists mainly so rpm's own auto-generated scriptlet epilogue, appended to // every %prep/%build/%install/etc, "for pid in $(jobs -p); do kill -9 ${pid} // || continue; done", finds a real command to run instead of "command not // found" turning into a bogus non-empty item list for that loop. // "jobs [-p|-l]": the background jobs ('&') still running. fresh has no // job control (no job numbers, no stopped jobs), so "-p" (pids only) is // the form that matters -- e.g. rpm's scriptlet epilogue "for pid in // $(jobs -p); do kill -9 ${pid} || continue; done". Without -p a line per // job is printed in the "[n] Running pid" shape. #include <iostream> #include "shell.h" Loading @@ -41,7 +41,19 @@ namespace fresh { namespace cmd { public: JobsCommand():ShellCommand("jobs"){} int runCommand(int,const char **){ int runCommand(int argc,const char **argv){ bool pidsOnly=false; for(int i=1; i<argc; ++i){ std::string a=argv[i]; if(a=="-p") pidsOnly=true; else if(a=="-l") pidsOnly=false; } std::vector<pid_t> jobs=Shell::instance().runningBackground(); for(size_t i=0; i<jobs.size(); ++i){ if(pidsOnly) std::cout << jobs[i] << "\n"; else std::cout << "[" << (i+1) << "] Running " << jobs[i] << "\n"; } std::cout.flush(); return 0; } }; Loading commands/shell/wait.cpp 0 → 100644 +66 −0 Changes for commands/shell/wait.cpp: 66 added lines, 0 removed lines. Original line number Diff line number Diff line /******************************************************************************* Copyright (c) 2026, Jan Koester jan.koester@gmx.net All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ // "wait [pid...]" (POSIX): without operands, waits for every background // job ('&') and returns 0; otherwise waits for each pid in turn and returns // the exit status of the last one -- 127 for a pid that is not one of this // shell's background jobs, 128+signal for one killed by a signal. #include <cstdlib> #include <iostream> #include "shell.h" namespace fresh { namespace cmd { class WaitCommand : public ShellCommand { public: WaitCommand():ShellCommand("wait"){} int runCommand(int argc,const char **argv){ Shell &sh=Shell::instance(); if(argc<2) return sh.waitAllBackground(); int rc=0; for(int i=1; i<argc; ++i){ char *end=nullptr; long pid=std::strtol(argv[i],&end,10); if(!end || *end || pid<=0){ std::cerr << "wait: " << argv[i] << ": not a pid" << std::endl; rc=2; continue; } bool known=true; rc=sh.waitBackground(static_cast<pid_t>(pid),known); } return rc; } }; FRESH_REGISTER_COMMAND(WaitCommand); }} src/envoirment.cpp +14 −0 Changes for src/envoirment.cpp: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -227,6 +227,10 @@ fresh::Environment::Environment(){ _variables[varname]=entry.substr(eq+1); _exported[varname]=true; } // $PPID (POSIX): the shell's parent at startup -- a PPID inherited // through the environment is replaced, and it is not exported _variables["PPID"]=std::to_string(getppid()); _exported.erase("PPID"); // An applet run directly (/usr/bin/env -> fresh, "#!/usr/bin/env // python3") returns before load() ever fills _path from config.yaml, so // runExternal() searched an empty list and every "env CMD" was "command Loading @@ -237,6 +241,10 @@ fresh::Environment::Environment(){ setVariable("PATH",p->second); } void fresh::Environment::setLastBackgroundPid(long pid){ _lastBgPid=pid; } void fresh::Environment::setLastStatus(int status){ _lastStatus=status; } Loading Loading @@ -464,6 +472,12 @@ std::string fresh::Environment::expand(const std::string &token){ continue; } if(i+1<token.length() && token[i+1]=='!'){ if(_lastBgPid>0) result+=std::to_string(_lastBgPid); ++i; continue; } // "$@"/"$*": joined with a single space here, same as any other // bare unquoted expansion this class of caller (pushRawToken()) // re-splits on whitespace afterward -- loses exact argument Loading Loading
commands/filesystem/dd.cpp +61 −10 Changes for commands/filesystem/dd.cpp: 61 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <cerrno> #include <cstdio> #include <chrono> #include <algorithm> #include <unistd.h> #include <fcntl.h> Loading Loading @@ -126,6 +127,23 @@ namespace fresh { namespace cmd { bool convNotrunc=false,convSync=false,convNoerror=false; bool convFsync=false,convFdatasync=false; std::string status; // iflag=/oflag= (GNU): open flags, plus fullblock and the // *_bytes forms that make count/skip/seek count bytes int iOpenFlags=0,oOpenFlags=0; bool fullblock=false,countBytes=false,skipBytes=false,seekBytes=false; auto openFlag=[](const std::string &f,int &flags)->bool{ if(f=="dsync") flags|=O_DSYNC; else if(f=="sync") flags|=O_SYNC; else if(f=="direct") flags|=O_DIRECT; else if(f=="append") flags|=O_APPEND; else if(f=="nonblock") flags|=O_NONBLOCK; else if(f=="noatime") flags|=O_NOATIME; else if(f=="nofollow") flags|=O_NOFOLLOW; else if(f=="noctty") flags|=O_NOCTTY; else if(f=="directory") flags|=O_DIRECTORY; else return false; return true; }; for(int i=1;i<argc;++i){ std::string arg=argv[i]; Loading Loading @@ -185,6 +203,19 @@ namespace fresh { namespace cmd { return 1; } } }else if(key=="iflag" || key=="oflag"){ bool in=(key=="iflag"); for(const std::string &f : splitComma(val)){ if(openFlag(f,in ? iOpenFlags : oOpenFlags)) continue; if(in && f=="fullblock") fullblock=true; else if(in && f=="count_bytes") countBytes=true; else if(in && f=="skip_bytes") skipBytes=true; else if(!in && f=="seek_bytes") seekBytes=true; else{ std::cerr << "dd: invalid " << (in ? "input" : "output") << " flag '" << f << "'" << std::endl; return 1; } } }else if(key=="status"){ status=val; if(status!="none" && status!="noxfer"){ Loading @@ -199,7 +230,7 @@ namespace fresh { namespace cmd { int inFd=0; if(!ifPath.empty()){ inFd=open(ifPath.c_str(),O_RDONLY); inFd=open(ifPath.c_str(),O_RDONLY|iOpenFlags); if(inFd<0){ std::cerr << "dd: " << ifPath << ": " << strerror(errno) << std::endl; return 1; Loading @@ -208,8 +239,10 @@ namespace fresh { namespace cmd { int outFd=1; if(!ofPath.empty()){ int flags=O_WRONLY|O_CREAT; if(!convNotrunc) int flags=O_WRONLY|O_CREAT|oOpenFlags; // oflag=append implies not truncating (GNU recommends // conv=notrunc with it; truncating would defeat append) if(!convNotrunc && !(oOpenFlags & O_APPEND)) flags|=O_TRUNC; outFd=open(ofPath.c_str(),flags,0644); if(outFd<0){ Loading @@ -222,20 +255,23 @@ namespace fresh { namespace cmd { int rc=0; if(skip>0){ if(lseek(inFd,(off_t)(skip*ibs),SEEK_CUR)==(off_t)-1){ unsigned long long skipLen=skipBytes ? skip : skip*ibs; if(lseek(inFd,(off_t)skipLen,SEEK_CUR)==(off_t)-1){ // Non-seekable input (a pipe): fall back to reading and // discarding skip whole ibs-sized blocks. // discarding skipLen bytes. std::vector<char> tmp(ibs); for(unsigned long long i=0;i<skip;++i){ ssize_t n=fullReadRetry(inFd,tmp.data(),tmp.size()); while(skipLen>0){ size_t want=(size_t)std::min<unsigned long long>(skipLen,tmp.size()); ssize_t n=fullReadRetry(inFd,tmp.data(),want); if(n<=0) break; skipLen-=(unsigned long long)n; } } } if(seek>0){ if(lseek(outFd,(off_t)(seek*obs),SEEK_CUR)==(off_t)-1){ if(lseek(outFd,(off_t)(seekBytes ? seek : seek*obs),SEEK_CUR)==(off_t)-1){ std::cerr << "dd: cannot seek output: " << strerror(errno) << std::endl; if(inFd!=0) close(inFd); if(outFd!=1) close(outFd); Loading @@ -252,11 +288,25 @@ namespace fresh { namespace cmd { std::vector<char> pending; pending.reserve(obs); unsigned long long bytesRead=0; for(;;){ if(haveCount && blocksRead>=count) if(haveCount && !countBytes && blocksRead>=count) break; size_t want=ibuf.size(); if(haveCount && countBytes){ if(bytesRead>=count) break; want=(size_t)std::min<unsigned long long>(want,count-bytesRead); } ssize_t n=fullReadRetry(inFd,ibuf.data(),ibuf.size()); ssize_t n=fullReadRetry(inFd,ibuf.data(),want); // iflag=fullblock: keep reading until the block is full // (or EOF) -- a pipe otherwise hands out short reads while(fullblock && n>0 && (size_t)n<want){ ssize_t more=fullReadRetry(inFd,ibuf.data()+n,want-(size_t)n); if(more<=0) break; n+=more; } if(n<0){ std::cerr << "dd: reading '" << (ifPath.empty()?"stdin":ifPath) << "': " << strerror(errno) << std::endl; if(convNoerror){ Loading @@ -274,6 +324,7 @@ namespace fresh { namespace cmd { break; blocksRead++; bytesRead+=(unsigned long long)n; size_t useLen=(size_t)n; if((size_t)n==ibuf.size()) inFull++; Loading
commands/shell/CMakeLists.txt +1 −0 Changes for commands/shell/CMakeLists.txt: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ target_sources(fresh PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/colon.cpp ${CMAKE_CURRENT_SOURCE_DIR}/umask.cpp ${CMAKE_CURRENT_SOURCE_DIR}/jobs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wait.cpp ${CMAKE_CURRENT_SOURCE_DIR}/trap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/case.cpp ${CMAKE_CURRENT_SOURCE_DIR}/exec.cpp Loading
commands/shell/jobs.cpp +20 −8 Changes for commands/shell/jobs.cpp: 20 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -25,13 +25,13 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ // "jobs [-p|-l]": fresh has no "&" backgrounding at all, so there is never // anything to report -- always succeeds with empty output, which is exactly // correct real-shell behavior when a shell genuinely has no background jobs. // Exists mainly so rpm's own auto-generated scriptlet epilogue, appended to // every %prep/%build/%install/etc, "for pid in $(jobs -p); do kill -9 ${pid} // || continue; done", finds a real command to run instead of "command not // found" turning into a bogus non-empty item list for that loop. // "jobs [-p|-l]": the background jobs ('&') still running. fresh has no // job control (no job numbers, no stopped jobs), so "-p" (pids only) is // the form that matters -- e.g. rpm's scriptlet epilogue "for pid in // $(jobs -p); do kill -9 ${pid} || continue; done". Without -p a line per // job is printed in the "[n] Running pid" shape. #include <iostream> #include "shell.h" Loading @@ -41,7 +41,19 @@ namespace fresh { namespace cmd { public: JobsCommand():ShellCommand("jobs"){} int runCommand(int,const char **){ int runCommand(int argc,const char **argv){ bool pidsOnly=false; for(int i=1; i<argc; ++i){ std::string a=argv[i]; if(a=="-p") pidsOnly=true; else if(a=="-l") pidsOnly=false; } std::vector<pid_t> jobs=Shell::instance().runningBackground(); for(size_t i=0; i<jobs.size(); ++i){ if(pidsOnly) std::cout << jobs[i] << "\n"; else std::cout << "[" << (i+1) << "] Running " << jobs[i] << "\n"; } std::cout.flush(); return 0; } }; Loading
commands/shell/wait.cpp 0 → 100644 +66 −0 Changes for commands/shell/wait.cpp: 66 added lines, 0 removed lines. Original line number Diff line number Diff line /******************************************************************************* Copyright (c) 2026, Jan Koester jan.koester@gmx.net All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ // "wait [pid...]" (POSIX): without operands, waits for every background // job ('&') and returns 0; otherwise waits for each pid in turn and returns // the exit status of the last one -- 127 for a pid that is not one of this // shell's background jobs, 128+signal for one killed by a signal. #include <cstdlib> #include <iostream> #include "shell.h" namespace fresh { namespace cmd { class WaitCommand : public ShellCommand { public: WaitCommand():ShellCommand("wait"){} int runCommand(int argc,const char **argv){ Shell &sh=Shell::instance(); if(argc<2) return sh.waitAllBackground(); int rc=0; for(int i=1; i<argc; ++i){ char *end=nullptr; long pid=std::strtol(argv[i],&end,10); if(!end || *end || pid<=0){ std::cerr << "wait: " << argv[i] << ": not a pid" << std::endl; rc=2; continue; } bool known=true; rc=sh.waitBackground(static_cast<pid_t>(pid),known); } return rc; } }; FRESH_REGISTER_COMMAND(WaitCommand); }}
src/envoirment.cpp +14 −0 Changes for src/envoirment.cpp: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -227,6 +227,10 @@ fresh::Environment::Environment(){ _variables[varname]=entry.substr(eq+1); _exported[varname]=true; } // $PPID (POSIX): the shell's parent at startup -- a PPID inherited // through the environment is replaced, and it is not exported _variables["PPID"]=std::to_string(getppid()); _exported.erase("PPID"); // An applet run directly (/usr/bin/env -> fresh, "#!/usr/bin/env // python3") returns before load() ever fills _path from config.yaml, so // runExternal() searched an empty list and every "env CMD" was "command Loading @@ -237,6 +241,10 @@ fresh::Environment::Environment(){ setVariable("PATH",p->second); } void fresh::Environment::setLastBackgroundPid(long pid){ _lastBgPid=pid; } void fresh::Environment::setLastStatus(int status){ _lastStatus=status; } Loading Loading @@ -464,6 +472,12 @@ std::string fresh::Environment::expand(const std::string &token){ continue; } if(i+1<token.length() && token[i+1]=='!'){ if(_lastBgPid>0) result+=std::to_string(_lastBgPid); ++i; continue; } // "$@"/"$*": joined with a single space here, same as any other // bare unquoted expansion this class of caller (pushRawToken()) // re-splits on whitespace afterward -- loses exact argument Loading