src/linux_parser.cpp
// TODO: Read and return the command associated with a process
Read and return the command associated with a process
Read and return the command associated with a process
string LinuxParser::Command(int pid) {
  string command;
  string filePath =
      kProcDirectory + "/" + to_string(pid) + "/" + kCmdlineFilename;
  std::ifstream istream(filePath);
  if (istream.is_open()) {
    while (getline(istream, command)) {
      return command;
    }
  }
  return string();
}
string LinuxParser :: Command ( int pid ) { string command ; string filePath = kProcDirectory + " " + to_string ( pid ) + " " + kCmdlineFilename ; std :: ifstream istream ( filePath ) ; if ( istream . is_open ( ) ) { while ( getline ( istream , command ) ) { return command ; } } return string ( ) ; }
TODO: Read and return the command associated with a process
TODO : Read and return the command associated with a process