Attempts to start process using the index file.
@param  {String} index Filename.
968963
function startForeverWithIndex( index, doneCB ) {
  log( 'Attempting to start ' + index + ' as daemon.');

  var config;
  var appendConfig = function(prop, value) {
    log('Adding to config: ' + prop + ', ' + value);
    if(value !== undefined) {
      config[prop] = value;
    }
  };
  done = doneCB || this.async();
  findProcessWithIndex( index, function(process) {
    // if found, be on our way without failing.
    if( typeof process !== 'undefined' ) {
      warn( index + ' is already running.');
      log( forever.format(true, [process]) );
      done();
    }
    else {
      gruntRef.file.mkdir(logDir);
      // 'forever start -o out.log -e err.log -c node -a -m 3 index.js';
      config = {
        command: commandName,
        append: true,
        max: 3,
        killSignal: killSignal
      };
      appendConfig('errFile', errFile);
      appendConfig('outFile', outFile);
      appendConfig('logFile', logFile);
      forever.startDaemon( index, config );
      log( 'Logs can be found at ' + logDir + '.' );
      done();
    }
  });
}
1081484
function processStateChange(index) {
    if (index >= 0 && index < this.state.headings.length && index !== this.state.index) {
        this.setState('index', index);
        emitAndFire(this, 'tab-select', { index });
    }
}
108118
def run_index_cmd(name, cmd):
    """"""
    sys.stderr.write("Creating {} index...\n".format(name))
    # Create index
    p = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
    stdout, stderr = p.communicate()
    if p.returncode != 0:
        sys.stderr.write("Index for {} failed\n".format(name))
        sys.stderr.write(stdout)
        sys.stderr.write(stderr)
860745
protected void handleLoadIndex(String indexLocation) {
        reportable.output("Loading resource from index file:");
        reportable.output("  " + indexLocation);

        File indexFile = new File(indexLocation);
        if (!indexFile.exists() || !indexFile.canRead()) {
            // try the index as an online resource.
            try {
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
                                indexLocation);
                indexFile = resolvedResource.getCacheResourceCopy();
            } catch (Exception e) {
                reportable.error("Index could not be read");
                bail(GENERAL_FAILURE);
            }
        }

        try {
            ResourceIndex.INSTANCE.loadIndex(indexFile);
        } catch (Exception e) {
            reportable.error("Unable to load index");
            reportable.error("Reason: " + e.getMessage());
            bail(GENERAL_FAILURE);
        }

        Index index = ResourceIndex.INSTANCE.getIndex();
        cacheMgrService.updateResourceIndexInCache(index);
    }
325098
@Override
	public void init(File jsonFile) throws IndexerException {
		try {
			config = new JsonSimpleConfig(jsonFile);
			init();
		} catch (IOException ioe) {
			throw new IndexerException(ioe);
		}
	}
729252
function ( value, index, array ) {
      if ( visited.hasOwnProperty(value) ) { return; }
      visited[value] = true;

      var deps = projectData.dependency[ value ];
      if ( !deps ) { return; }

      for ( var i = 0; i < deps.length; ++i ) {
        var depAbsPath = projectData.id2File[ deps[i] ];

        if ( !depAbsPath ) {
          grunt.fail.fatal("Can't find file when merging, the file might exist but it's not a Sea.js module : [ " + deps[i] + " ]" );
        }

        this.push( depAbsPath );
        reverse_dep_map[ depAbsPath ] = true;
      }
    }
1191521
private void addIndex(final String index) throws IOException {

        logger.info("Adding index '{}'...", index);

        String resourcePath = "/" + index;

        if (doesResourceNotExist(resourcePath)) {

            try {
                elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath);

                logger.info("Added '{}' index", index);
            } catch (ResponseException e) {

                boolean errorCreatingIndex = true;

                Response errorResponse = e.getResponse();
                if (errorResponse.getStatusLine().getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
                    JsonNode root = objectMapper.readTree(EntityUtils.toString(errorResponse.getEntity()));
                    String errorCode = root.get("error").get("type").asText();
                    if ("index_already_exists_exception".equals(errorCode)) {
                        errorCreatingIndex = false;
                    }
                }

                if (errorCreatingIndex) {
                    throw e;
                }
            }
        } else {
            logger.info("Index '{}' already exists", index);
        }
    }
282205
def _run(self, index):
        
        while 1:
            try:
                item = self._queue.get(timeout=2)
                self.process_item(item)
            except Queue.Empty:
                break
            except Exception as err:
                _log.error("In _run(): {}".format(err))
                if _log.isEnabledFor(logging.DEBUG):
                    _log.error(traceback.format_exc())
                self._status.fail(index)
                raise
        self._status.success(index)
285017
function(inputIndex) {

            _.each(tokens, function(token, index) {
                // determain whether or not this is a file reference or a string
                if(token.file) {

                    // read the file and reset replacement to what was loaded
                    fs.readFile(token.file, 'utf8', function(e, data) {
                        if(e) {
                            grunt.fail.warn("There was an error processing the replacement '" + token.file + "' file.");
                        }
                        tokens[index].contents = data;
                        processTokenCompleteCallback();
                    });

                } else if(token.string) {
                    // we didn't need to load a file
                    tokens[index].contents = token.string;
                    processTokenCompleteCallback();
                } else {
                    processTokenCompleteCallback();
                }

            }, this);
        }
112859
public void setStart(int index, Date value)
   {
      set(selectField(TaskFieldLists.CUSTOM_START, index), value);
   }
342762
public void createIndex(String index, boolean ignoreErrors, String indexSettings) throws IOException {
        logger.debug("create index [{}]", index);
        logger.trace("index settings: [{}]", indexSettings);

        try {
            Response response = lowLevelClient.performRequest("PUT", "/" + index,
                    Collections.emptyMap(), createEntity(indexSettings));
            logger.trace("create index response: {}", asMap(response));
        } catch (ResponseException e) {
            if (e.getResponse().getStatusLine().getStatusCode() == 400 &&
                    (e.getMessage().contains("index_already_exists_exception"))) {
                if (!ignoreErrors) {
                    throw new RuntimeException("index already exists");
                }
                logger.trace("index already exists. Ignoring error...");
                return;
            }
            throw e;
        }
        waitForHealthyIndex(index);
    }
1185053
public void load(AjaxRequestTarget ajaxRequestTarget, int index)
	{
		ajaxRequestTarget.appendJavaScript(this.load(index).render().toString());
	}
656824
void commit(long index) {
    if (event != null && event.eventIndex == index) {
      events.add(event);
      sendEvent(event);
    }
  }
519699
function(index) {
    if(lang.isNumber(index)&& this._elColgroup) {
        var nextSibling = this._elColgroup.childNodes[index] || null;
        this._elColgroup.insertBefore(document.createElement("col"), nextSibling);
    }
}
988797
private static Process action(final String fileName,
			String parameters, boolean waitForTermination) throws IOException {
		Process process = null;
		if (parameters.trim().length() > 0) {
			parameters = " " + parameters.trim();
		}
		else {
			parameters = "";
		}
		if (acroread != null) {
			process = Runtime.getRuntime().exec(
					acroread + parameters + " \"" + fileName + "\"");
		}
		else if (isWindows()) {
			if (isWindows9X()) {
				process = Runtime.getRuntime().exec(
						"command.com /C start acrord32" + parameters + " \"" + fileName + "\"");
			}
			else {
				process = Runtime.getRuntime().exec(
					"cmd /c start acrord32" + parameters + " \"" + fileName + "\"");
			}
		}
		else if (isMac()) {
			if (parameters.trim().length() == 0) {
				process = Runtime.getRuntime().exec(
					new String[] { "/usr/bin/open", fileName });
			}
			else {
				process = Runtime.getRuntime().exec(
						new String[] { "/usr/bin/open", parameters.trim(), fileName });
			}
		}
		try {
			if (process != null && waitForTermination)
				process.waitFor();
		} catch (InterruptedException ie) {
		}
		return process;
	}
1230965
public boolean isExistingIndex(String index) throws IOException {
        logger.debug("is existing index [{}]", index);
        GetIndexRequest gir = new GetIndexRequest();
        gir.indices(index);
        return client.indices().exists(gir, RequestOptions.DEFAULT);
    }
263123
private boolean createIndex(String index, Map<String, Object> defaultSettings) {
        IndicesExistsResponse res = client.admin().indices().prepareExists(index).execute().actionGet();
        boolean created = false;
        if (!res.isExists()) {
            CreateIndexRequestBuilder req = client.admin().indices().prepareCreate(index);
            req.setSettings(defaultSettings);
            created = req.execute().actionGet().isAcknowledged();
            if (!created) {
                throw new RuntimeException("Could not create index [" + index + "]");
            }
        }

        return created;
    }