subprocess icon indicating copy to clipboard operation
subprocess copied to clipboard

Error in the documention

Open jm130794 opened this issue 1 year ago • 0 comments

Hello,

In the documentation, this sample doesn't work :

subprocess::command cmd("touch " + file_path.string()).run();
#include <iostream>
#include <filesystem>
#include <subprocess/subprocess.hpp>

using namespace subprocess::literals;

int main()
{
    std::filesystem::path file_path{"/tmp/file.txt"};
    
    // error
    //subprocess::command cmd("touch " + file_path.string()).run();

    // ok
    subprocess::command cmd2("touch " + file_path.string());
    cmd2.run();
}

When I try to compile, I get this errror on gcc 11 :+1:

main.cpp: In function 'int main()':
main.cpp:12:59: error: expected ',' or ';' before '.' token
   12 |     subprocess::command cmd("touch " + file_path.string()).run();
      |                                                         

Is this an error in the documentation?

Jean-Marc

jm130794 avatar Mar 07 '23 12:03 jm130794