<commit_before>#!/usr/bin/env node
'use strict';

var net = require('net');
var fs = require('fs');
var eslint = require('eslint');

var engine = new eslint.CLIEngine();
var formatter = engine.getFormatter('compact');

var server = net.createServer({
  allowHalfOpen: true
}, function (con) {
  var data = '';
  con.on('data', function (chunk) {
    data += chunk;
  });
  con.on('end', function () {
    var report = engine.executeOnFiles([data]);
    con.write(formatter(report.results));
    con.end();
  });
});

var portFile = process.env.HOME + '/.eslint_d_port';
server.listen(function () {
  var port = server.address().port;
  fs.writeFileSync(portFile, String(port));
});

process.on('exit', function () {
  fs.unlinkSync(portFile);
});
process.on('SIGINT', function () {
  process.exit();
});<commit_msg>Remove port file on kill<commit_after>#!/usr/bin/env node
'use strict';

var net = require('net');
var fs = require('fs');
var eslint = require('eslint');

var engine = new eslint.CLIEngine();
var formatter = engine.getFormatter('compact');

var server = net.createServer({
  allowHalfOpen: true
}, function (con) {
  var data = '';
  con.on('data', function (chunk) {
    data += chunk;
  });
  con.on('end', function () {
    var report = engine.executeOnFiles([data]);
    con.write(formatter(report.results));
    con.end();
  });
});

var portFile = process.env.HOME + '/.eslint_d_port';
server.listen(function () {
  var port = server.address().port;
  fs.writeFileSync(portFile, String(port));
});

process.on('exit', function () {
  fs.unlinkSync(portFile);
});
process.on('SIGTERM', function () {
  process.exit();
});
process.on('SIGINT', function () {
  process.exit();
});
{'fraction_non_alphanumeric': 0.1983519717480871, 'fraction_numerical': 0.0, 'mean_word_length': 4.3627760252365935, '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': '7008420', 'n_tokens_mistral': 577, 'n_tokens_neox': 568, 'n_words': 121}