Skip to content

Error in the documention #26

Description

@jm130794

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 👍

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions