<commit_before>/*
man gcc
 You can specify the input language explicitly with the -x option:

 -x language
     Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix).  This option
     applies to all following input files until the next -x option.  Possible values for language are:

             c  c-header  cpp-output
             c++  c++-header  c++-cpp-output
             objective-c  objective-c-header  objective-c-cpp-output
             objective-c++ objective-c++-header objective-c++-cpp-output
             assembler  assembler-with-cpp
             ada
             d
             f77  f77-cpp-input f95  f95-cpp-input
             go
             java
*/
'use strict';

var debug = require('debug')('secc:'+process.pid+':compile');
var util = require("util");
var stream = require("stream");
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var zlib = require('zlib');

var async = require('async');

var utils = require('./utils');
var environment = require('./environment.js');

function CompileStream(options) {
  //debug(options);
  var self = this;

  var options = options || {};
  if (typeof options.timeout !== 'number')
    options.timeout = 60 * 2 * 1000;

  this.buildNative = (typeof options.buildNative === 'undefined') ? true : options.buildNative;

  this.archiveId = options.archiveId;
  this.buildRoot = options.buildRoot || path.join(__dirname,'..','run', this.buildNative ? '' : this.archiveId);

  this.outputPath = options.outputPath || '/tmp/SECC-'+crypto.pseudoRandomBytes(16).toString('hex');
  this.compiler = (options.compiler) ? '/usr/bin/' + options.compiler : '/usr/bin/gcc';
  this.language = options.language || 'c';
  this.fileName = options.fileName || path.basename(this.outputPath);
  this.usingPipe = (typeof options.usingPipe === 'undefined') ? true : options.usingPipe;
  this.sourceFile = options.sourceFile;
  this.workingDirectory = options.workingDirectory || '.';
  this.cache = options.cache || false;
  this.redisClient = options.redisClient || null;
  this.argv = (typeof options.argv === 'undefined') ? [] : options.argv;
  this.cross = (typeof options.cross === 'undefined') ? false : options.cross;
  this.target = (typeof options.target === 'undefined') ? null : options.target;

  this._stdout;
  this._stderr;
  this._error;
  this.outputFiles = [];
  this.timerFired = false;
  this.sourceHash = null;
  this.hash = crypto.createHash('md5');
  this.hash.setEncoding('hex');

  var spawn = require('child_process').spawn;
  var newArgv = this.argv.slice();<commit_msg>[daemon] bug fix. using '/tmp/secc/run' for default compile path<commit_after>'use strict';

var debug = require('debug')('secc:'+process.pid+':compile');

var crypto = require('crypto');
var fs = require('fs');
var os = require('os');
var path = require('path');
var stream = require("stream");
var util = require("util");
var zlib = require('zlib');

var async = require('async');

var utils = require('./utils');
var environment = require('./environment.js');

function CompileStream(options) {
  //debug(options);
  var self = this;

  var options = options || {};
  if (typeof options.timeout !== 'number')
    options.timeout = 60 * 2 * 1000;

  this.buildNative = (typeof options.buildNative === 'undefined') ? true : options.buildNative;

  this.archiveId = options.archiveId;
  this.buildRoot = options.buildRoot || path.join(os.tmpdir(), 'secc', 'run', this.buildNative ? '' : this.archiveId);

  this.outputPath = options.outputPath || '/tmp/SECC-'+crypto.pseudoRandomBytes(16).toString('hex');
  this.compiler = (options.compiler) ? '/usr/bin/' + options.compiler : '/usr/bin/gcc';
  this.language = options.language || 'c';
  this.fileName = options.fileName || path.basename(this.outputPath);
  this.usingPipe = (typeof options.usingPipe === 'undefined') ? true : options.usingPipe;
  this.sourceFile = options.sourceFile;
  this.workingDirectory = options.workingDirectory || '.';
  this.cache = options.cache || false;
  this.redisClient = options.redisClient || null;
  this.argv = (typeof options.argv === 'undefined') ? [] : options.argv;
  this.cross = (typeof options.cross === 'undefined') ? false : options.cross;
  this.target = (typeof options.target === 'undefined') ? null : options.target;

  this._stdout;
  this._stderr;
  this._error;
  this.outputFiles = [];
  this.timerFired = false;
  this.sourceHash = null;
  this.hash = crypto.createHash('md5');
  this.hash.setEncoding('hex');

  var spawn = require('child_process').spawn;
  var newArgv = this.argv.slice();
{'fraction_non_alphanumeric': 0.15908115070845857, 'fraction_numerical': 0.0060111635895234005, 'mean_word_length': 3.7735655737704916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '453697', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1389, 'n_words': 343}